package kr.hkit.powerjava.chapter14.work2;

import java.awt.Container;
import java.awt.Dimension;
import java.awt.Toolkit;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;
import javax.swing.JTextField;

import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class MyFrame extends JFrame implements ActionListener{
	private Container con;
	private JTabbedPane tab;
	private JPanel pro1panel;
	private JPanel pro2panel;
	private CarPanel01 panel;
	Toolkit kit = Toolkit.getDefaultToolkit();
	Dimension screenSize = kit.getScreenSize();
	private static double MILE = 1.609344;
	
	public MyFrame(){
	setTitle("ch 14. Programming");
	setSize(300,300);
	setLocation(screenSize.width/2, screenSize.height/2);
	
	con = getContentPane();

	pro1panel = new JPanel();
	pro2panel = new JPanel();
	
	tab = new JTabbedPane();
	tab.addTab("마일계산기", pro1panel);
	tab.addTab("이자계산기", pro2panel);
	
	JLabel lbl1a = new JLabel("<< 마일을 킬로미터로 변환 >>");
	JLabel lbl1b = new JLabel("거리를 마일 단위로 입력하세요!");
	pro1panel.add(lbl1a);
	
	JTextField txt1a = new JTextField(5);
	txt1a.setText("");
	pro1panel.add(txt1a);

	txt1a.addActionListener(this);

	JButton btn1 = new JButton("변환");
	btn1.addActionListener(this);
	pro1panel.add(btn1);
	JTextField resultTxt = new JTextField(25);
	pro1panel.add(resultTxt);
	
	JLabel lbl2a = new JLabel("<< 이자 계산기 >>");
	pro2panel.add(lbl2a);
	getContentPane().add(tab);
	setVisible(true);
	setResizable(false);
	}
	
	public static void main(String[] args) {
		MyFrame t1 = new MyFrame();
	}

	@Override
	public void actionPerformed(ActionEvent e) {
		// TODO Auto-generated method stub
		
	}
	
}
